﻿@using AbpCompanyName.AbpProjectName.WebMpa.Models.Common.Modals
@model AbpCompanyName.AbpProjectName.WebMpa.Models.Users.EditUserModalViewModel
@{
    Layout = null;
}
@Html.Partial("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditUser")))

<div class="modal-body">
    <form name="UserEditForm" role="form" novalidate class="form-validation">
        <input type="hidden" name="Id" value="@Model.User.Id" />
        <ul class="nav nav-tabs tab-nav-right" role="tablist">
            <li role="presentation" class="active"><a href="#edit-user-details" data-toggle="tab">User Details</a></li>
            <li role="presentation"><a href="#edit-user-roles" data-toggle="tab">User Roles</a></li>
        </ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane animated fadeIn active" id="edit-user-details">

                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="username" type="text" name="UserName" value="@Model.User.UserName" required maxlength="32" minlength="2" class="validate form-control">
                                <label for="username" class="form-label">@L("UserName")</label>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row clearfix">
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="name" type="text" name="Name" value="@Model.User.Name" required maxlength="32" class="validate form-control">
                                <label for="name" class="form-label">@L("Name")</label>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="surname" type="text" name="Surname" value="@Model.User.Surname" required maxlength="32" class="validate form-control">
                                <label for="surname" class="form-label">@L("Surname")</label>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row clearfix">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="email" type="email" name="EmailAddress" value="@Model.User.EmailAddress" maxlength="256" class="validate form-control">
                                <label for="email" class="form-label">@L("EmailAddress")</label>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row clearfix">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="">
                                <input id="IsActive" type="checkbox" name="IsActive" value="true" @(Model.User.IsActive ? "checked" : "") class="form-control" />
                                <label for="IsActive" class="form-label">@L("IsActive")</label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div role="tabpanel" class="tab-pane animated fadeIn" id="edit-user-roles">
                <div class="row">
                    <div class="col-sm-12 ">
                        @foreach (var role in Model.Roles)
                        {
                            <div class="col-sm-6">
                                <input type="checkbox" name="role" data-role-name="@role.Name" title="@role.Description" class="filled-in" id="@string.Format("role{0}",role.Id)" @(Model.UserIsInRole(role) ? "checked" : "") />
                                <label for="@string.Format("role{0}",role.Id)" title="@role.DisplayName">@role.Name</label>
                            </div>
                        }
                    </div>
                </div>
            </div>

        </div>
    </form>
</div>

@Html.Partial("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml")

<script src="~/Views/Users/_EditUserModal.js"></script>